using System;

public class MyDateTime
{
    public const int HourToMinute = 60;
    public const decimal MinuteToHour = 1 / (decimal)HourToMinute;
    public const int DayToHour = 24;
    public const decimal HourToDay = 1 / (decimal)DayToHour;
    public const int DayToMinute = DayToHour * HourToMinute;
    public const decimal MinuteToDay = 1 / (decimal)DayToMinute;

    public static long ToMinute(decimal day, decimal hour, int minute = 0)
    {
        return (long)(day * DayToMinute) + (long)(hour * HourToMinute) + minute;
    }

    private long totalMinute;
    public long TotalMinute
    {
        get => totalMinute;
        set
        {
            if (value < 0)
                throw new ArgumentOutOfRangeException();
            totalMinute = value;
        }
    }

    public int Day
    {
        get => (int)(TotalMinute * MinuteToDay);
        set
        {
            if (value < 0)
                throw new ArgumentOutOfRangeException();
            TotalMinute += (value - Day) * DayToMinute;
        }
    }

    public float HourOfDay
    {
        get => (float)(TotalMinute * MinuteToHour);
        set
        {
            if (value < 0 || value >= DayToHour)
                throw new ArgumentOutOfRangeException();
            TotalMinute += (long)((value - HourOfDay) * HourToMinute);
        }
    }

    public int HourOfDayWithoutMinute
    {
        get => (int)(TotalMinute * MinuteToHour) % DayToHour;
        set
        {
            if (value < 0 || value >= DayToHour)
                throw new ArgumentOutOfRangeException();
            TotalMinute += (value - HourOfDayWithoutMinute) * HourToMinute;
        }
    }

    public int MinuteOfDay
    {
        get => (int)(TotalMinute % DayToMinute);
        set
        {
            if (value < 0 || value >= DayToMinute)
                throw new ArgumentOutOfRangeException();
            TotalMinute += value - MinuteOfDay;
        }
    }

    public int MinuteOfHour
    {
        get => (int)(TotalMinute % HourToMinute);
        set
        {
            if (value < 0 || value >= HourToMinute)
                throw new ArgumentOutOfRangeException();
            TotalMinute += value - MinuteOfHour;
        }
    }
}
